<admintpl file="header"/>
</head>
<?php if($type == '1'){?>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:U('Admin/AdminUser/index')}">账号列表</a></li>
    </ul>

    <form class="well form-search" id="query_form" method="post" action="{:U('Admin/AdminUser/index')}">
        姓名：
        <input type="text" name="adminUserName" style="width: 120px;" value="{$formParam.adminUserName}" placeholder="姓名...">
        <input type="button" name="query_form_btn" id="queryBtn" data-action="{:U('Admin/AdminUser/index')}"  class="btn btn-primary" value="查询"/>
        <a href='{:U("Admin/AdminUser/adminUserAdd")}' class="btn btn-primary" >添加</a>
        <a href='{:U("Admin/Special/index")}' class="btn btn-primary" >专题临时入口</a>
        <br/><br/>
        
    </form>
    <form class="js-ajax-form" action="" method="post">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>序号</th>
                <th>姓名</th>
                <th>账号</th>
                <th>密码</th>
                <th>权限</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <?php $tmp_key = 0;?>
            <foreach name="data" item="vo">
                <tr>
                    <td>{$key+1}</td>
                    <td>{$vo.real_name}</td>
                    <td>{$vo.username}</td>
                    <td>{$vo.admin_pwd}<a href='{:U("Admin/AdminUser/resetPwdPost",array("admin_id"=>$vo["admin_id"]))}' class="js-ajax-dialog-btn" style="float:right;"
                           data-msg="确定要重置密码吗？重置后密码为：123456">重置</a></td>
                    <td>
                    <?php
                    	$role_str = '';
                    	if($vo['role_list']['column_role_count'] > 0) $role_str.= "新闻业务:";
						foreach($vo['role_list']['column_role'] as $column_role_key=>$column_role_value){
							$role_str.= $column_role_value['name'].',';
						}
						$role_str = rtrim($role_str,',');

						if($vo['role_list']['sys_menu_role_count'] > 0) $role_str.= "</br>其他业务:";
						foreach($vo['role_list']['sys_menu_role'] as $sys_menu_role_key=>$sys_menu_role_value){
							$role_str.= $sys_menu_role_value['name'].',';
						}
						$role_str = rtrim($role_str,',');

                        if($vo['role_list']['company_info']){
                            $role_str.= "</br>所属公司:";
                            $role_str.= $vo['role_list']['company_info'].',';
                        }
                        $role_str = rtrim($role_str,',');
					
						echo $role_str;
	
                    ?>
                    
                    </td>
                    <td>
                        <a href='javascript:void(0);' onclick="edit_role({$vo['admin_id']})" >权限设置</a>
                        <a href='{:U("Admin/AdminUser/del",array("adminUserId"=>$vo["admin_id"]))}' class="js-ajax-dialog-btn"
                           data-msg="确定要删除此业务管理员吗？">删除</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
    <div class="pagination">{$page}</div>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script src="__PUBLIC__/js/2.1.4jquery.js"></script>
<script>
    $(document).ready(function () {
        $('input[name="query_form_btn"]').click(function () {
            $('#query_form').attr('action', $(this).attr('data-action'));
            $('#query_form').submit();
        });
    });
    
 function edit_role(admin_id){
	  layer.open({
  	    type: 2,
  	    //skin: 'layui-layer-lan',
  	    title: '修改管理员权限',
  	    fix: false,
  	    shadeClose: true,
  	    maxmin: true,
  	    area: ['1000px', '500px'],
  	    content: "<?php echo U('Admin/AdminUser/editRole')?>"+'&admin_id='+admin_id,
  	    end: function(){
  	    	location.reload();
  	    }
  	  });
 }
</script>
</body>




<!-- 业务管理员页面 -->




<?php
	}else{
?>
<body>
<div class="wrap js-check-wrap">
    <form class="well form-search" id="query_form" method="post" action="{:U('Admin/AdminUser/index')}">
        姓名：{$data['real_name']}</br>
        账号：{$data['username']}</br>
        密码：{$data['admin_pwd']}&nbsp;&nbsp;&nbsp;<a href='jsvascript:;' onclick="reset_pwd({$data["admin_id"]})" >重置密码</a></br>
    </form>
    
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
 function reset_pwd(admin_id){
	  layer.open({
  	    type: 2,
  	    //skin: 'layui-layer-lan',
  	    title: '修改管理员权限',
  	    fix: false,
  	    shadeClose: true,
  	    maxmin: true,
  	    area: ['1000px', '500px'],
  	    content: "<?php echo U('Admin/AdminUser/resetPwd')?>"+'&admin_id='+admin_id,
  	    end: function(){
  	    	location.reload();
  	    }
  	  });
 }
</script>
</body>
<?php
	}
?>
</html>